Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

Resources

Exercise

In this exercise, we're joining snowfall data to a set of road records and writing the results to an FTP site for other users to access. We'll create a workspace that joins local data to an online dataset, processes the data, and writes it to a different web destination.

1) Add Reader

Reader Format Autodesk AutoCAD DWG/DXF
Reader Dataset

https://s3.amazonaws.com/FMEData/FMEData/Data/Transportation/CompleteRoads.dwg

or 

C:\FMEData\Data\Transportation\CompleteRoads.dwg

Parameters Group Entities By: Attribute Schema
Parameters Coordinate System: UTM84-10N
Workflow Options Single Merged Feature Type

The Group Entities parameter is an AutoCAD-specific option. It ensures that the attributes from the AutoCAD source data are exposed in Workbench.

The Merged Feature Type option treats all the road data as a single map layer, which is fine because we don't want to handle multiple layers separately.

Note

We are just reading a file from a URL here. If you can access a cloud data storage provider such as Google Drive or Dropbox, try copying CompleteRoads.dwg to a folder on that service. Then, use the Select File From Web functionality to authenticate, connect, and read the data.

2) Locate Snowfall Dataset

Copying a link

3) Add DatabaseJoiner Transformer

Reader Format Microsoft Excel
Reader Dataset https://s3.amazonaws.com/FMEData/Interopolis/Snowfall.xlsx

Configured DatabaseJoiner

Fields to Add

4) Add FeatureWriter Transformer

Now, it's time to write the data. Writing data directly to a web service is more complex, so we'll create a zipped, file-based dataset and then upload it to a web service.

Writer Format OGC / Google KML
Writer Dataset C:\FMEData\Output\Training\RoadSnowfall.kml

Zip output

Renaming to SnowfallPredictions

 

5) Add FTPCaller Transformer

Adding the FTPCaller

ftp://ftp.safe.com/incoming/training/@UUID()RoadSnowfall.zip

6) Run Translation

Congratulations! You have successfully read and written data using web data connectors.

Optional Challenge: KML Styling

The project aims to write the data to KML format. As a training exercise, we're only interested in how and where we write the data. However, a realistic requirement would be to set the color and style of the spatial data being written (in spatial terms, we sometimes call this symbology). Try adding a KMLStyler and setting features' Color using conditional values. For example, make streets with 0 EstimatedSnowfall green, between 0 and 150 yellow, and over 150 red.

Challenge Answer: Open after attempting the challenge.

 

Optional Challenge: Dynamic File Handling in FTPCaller

Intead of hardcoding the dataset name into the FTPCaller's URL parameter (the RoadSnowfall.zip part), configure the FTPCaller to dynamically handle the URL based on the value of _dataset from the FeatureWriter.

Additionally, try doing something similar for the File to Upload parameter.

Challenge Answer: Open after attempting the challenge.